from langchain.chat_models import ChatDeepseek
from langchain.schema import HumanMessage, SystemMessage
import os
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

def main():
    # 初始化 DeepSeek 聊天模型
    chat = ChatDeepseek(
        deepseek_api_key=os.getenv("DEEPSEEK_API_KEY"),
        model_name="deepseek-chat",
        temperature=0.7,
        max_tokens=1000
    )

    # 创建系统消息
    system_message = SystemMessage(content="你是一个有帮助的AI助手。")
    
    # 创建用户消息
    human_message = HumanMessage(content="你好，请介绍一下你自己。")

    # 发送消息并获取响应
    messages = [system_message, human_message]
    response = chat(messages)
    
    print("AI响应:", response.content)

if __name__ == "__main__":
    main() 